@extends('layouts.admin')

@section('scripts')
    <script src="{{asset('DatePicker/WdatePicker.js')}}"></script>
@stop

@section('content')
    <div class="console-title">
        <a href="{{admin_url('commission/withdraw')}}" class="float-right">
            <span class="btn btn-primary">返回列表</span>
        </a>
        <h2>审核提现</h2>
    </div>
    <div class="content-div">
        <form method="post" id="adForm">
            {{form_verify_field()}}
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="formtable">
                <tbody>
                <tr>
                    <td width="80">申请人</td>
                    <td>{{$withdraw['user']['username']}}</td>
                </tr>
                <tr>
                    <td>开户银行</td>
                    <td>{{$withdraw['card']['bank']}}</td>
                </tr>
                <tr>
                    <td>银行账户</td>
                    <td>{{$withdraw['card']['account_id']}}</td>
                </tr>
                <tr>
                    <td>提现金额</td>
                    <td>{{$withdraw['amount']}}</td>
                </tr>
                <tr>
                    <td>支行信息</td>
                    <td>{{$withdraw['card']['branch']}}</td>
                </tr>
                <tr>
                    <td>申请时间</td>
                    <td>{{@date('Y-m-d H:i:s', $withdraw['created_at'])}}</td>
                </tr>
                <tr>
                    <td>审核状态</td>
                    <td>
                        @if ($withdraw['status'] == 0)
                            审核中
                        @elseif ($withdraw['status'] == 1)
                            已同意
                        @else
                            已拒绝
                        @endif
                    </td>
                </tr>
                </tbody>
                @if (!$withdraw['status'])
                    <tfoot>
                    <tr>
                        <td colspan="2">
                            <button type="button" class="btn btn-primary" id="resolve">同意提现</button>
                            <button type="button" class="btn btn-default" id="reject">不同意提现</button>
                        </td>
                    </tr>
                    </tfoot>
                @endif
            </table>
        </form>
    </div>
@stop

@section('foot')
    <script type="text/javascript">
        $("#resolve").on('click', function () {
            $.ajax({
                url:'{{admin_url('commission/resolvewithdraw')}}',
                data:{id:'{{$id}}'},
                beforeSend:DSXUI.showSpinner,
                success:function (response) {
                    setTimeout(function () {
                        DSXUI.hideSpinner();
                        window.location.href = '{{admin_url('commission/withdraw')}}';
                    }, 500);
                }
            })
        });
        $("#reject").on('click', function () {
            $.ajax({
                url:'{{admin_url('commission/rejectwithdraw')}}',
                data:{id:'{{$id}}'},
                beforeSend:DSXUI.showSpinner,
                success:function (response) {
                    setTimeout(function () {
                        DSXUI.hideSpinner();
                        window.location.href = '{{admin_url('commission/withdraw')}}';
                    }, 500);
                }
            })
        })
    </script>
@stop
